<?php
declare (strict_types=1);

namespace app\validate;

use think\Validate;

class User extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'profile.name' => ['require'],
        'card' => ['require', 'idCard'],
        'student_id' => ['require'],
        'phone' => ['require', 'mobile'],
        'profile.gender' => 'require',
        'profile.grade' => 'require',
        'profile.class' => 'require',
        'profile.qq_account' => 'require',
        'profile.cnc_experience' => 'require'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'profile.name.require' => '名字为必填字段',
        'student_id.require' => '学号为必填字段',
        'gender.require' => '性别为必填字段',
        'grade.require' => '年级为必填字段',
        'class.require' => '班级为必填字段',
        'phone.require' => '手机号为必填字段',
        'phone.mobile' => '手机号格式错误',
        'card.require' => '身份证号为必填字段',
        'card.idCard' => '身份证号格式错误',
        'cnc_experience.require' => '数控基础为必填字段'
    ];
}
